package com.stox.client.embedded.screener;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.stox.client.api.screener.ScreenerClient;
import com.stox.services.screener.manager.ScreenerManager;
import com.stox.shared.beans.BeanDescriptor;
import com.stox.shared.model.ScreenBeanDescriptor;
import com.stox.shared.model.ScreenerConfiguration;

@Component
public class EmbeddedScreenerClient implements ScreenerClient {

	@Autowired
	private ScreenerManager screenerManager;
	
	@Override
	public List<ScreenBeanDescriptor> findAll() {
		return screenerManager.findAll();
	}

	@Override
	public void start(String scanId, ScreenerConfiguration screenerConfiguration, ScreenBeanDescriptor screenBeanDescriptor) {
		screenerManager.start(scanId, screenerConfiguration, screenBeanDescriptor);
	}

	@Override
	public void cancel(String scanId) {
		screenerManager.cancel(scanId);
	}
	
	@Override
	public double completionPercentage(String scanId) {
		return screenerManager.completionPercentage(scanId);
	}
	
	@Override
	public List<BeanDescriptor> getMatches(String scanId) {
		return screenerManager.getMatches(scanId);
	}

}
